[client]
default-character-set=utf8mb4
socket={{mysql_datadir}}/mysql.sock

[mysqld]
#skip-grant-tables
server-id=100
mysqlx_socket = {{mysql_datadir}}/mysqlx.sock

log-bin={{mysql_datadir}}/log/mysql-bin
max_binlog_size=500M
binlog_expire_logs_seconds=604800 #七天失效
sync_binlog=1 #默认为1
relay_log={{mysql_datadir}}/log/msql-relay.log

skip_name_resolve=on

default-storage-engine=INNODB
innodb_buffer_pool_size=200M
max_allowed_packet=256M  #默认是64M
max_connections=1000

port=3306
pid-file={{mysql_datadir}}/mysqld.pid
basedir={{mysql_basedir}}
datadir={{mysql_datadir}}/data
log-error={{mysql_datadir}}/error.log
socket={{mysql_datadir}}/mysql.sock
#注意socket需要在[client]和[mysqld]里面配置,否则启动后本地不能连接到mysql

#是否开启慢日志和普通查询的记录
log-output=FILE,TABLE
general_log=0
general_log_file={{mysql_datadir}}/log/general-query.log
slow_query_log=ON
slow_query_log_file={{mysql_datadir}}/log/slow-query.log
long_query_time=2 #默认为10秒
#非严格模式
sql_mode="STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION,NO_ZERO_DATE,NO_ZERO_IN_DATE,ERROR_FOR_DIVISION_BY_ZERO"
#mysql8.0的默认排序规则为：utf8mb4_0900_ai_ci
collation_server=utf8mb4_general_ci